package io.seata.account.web;

import io.seata.account.service.AccountService;
import io.seata.account.service.AccountTCCService;
import io.seata.common.dto.AccountDTO;
import io.seata.common.response.ObjectResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ZengRJ
 */
@RestController
@RequestMapping("account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @Resource
    private AccountTCCService accountTCCService;

    @PutMapping("/deduct")
    public ObjectResponse deduct(@RequestBody AccountDTO accountDTO){
//        return accountService.deduct(accountDTO);
        return accountTCCService.deduct(accountDTO);
    }
}
